import http from '@/utils/http';

export function useLogin(data: { id_card: string; password: string }) {
  return http({
    url: '/studentAppLogin.do',
    method: 'post',
    data: data,
  });
}

export function getStudentAppScore(key: number) {
  return http({
    url: '/getStudentAppScore.do',
    method: 'post',
    data: {
      key,
    },
  });
}

export function getExamList(key: number) {
  return http({
    url: '/getStudentAppTest.do',
    method: 'post',
    data: {
      key,
    },
  });
}

export function getStudentErrorTopic(key: number) {
  return http({
    url: '/getStudentAppWrongs.do',
    method: 'post',
    data: {
      key,
    },
  });
}

export function getExamResultList(name: string) {
  return http({
    url: '/studentAppScoreRank.do',
    method: 'post',
    data: {
      class_name: name,
    },
  });
}

export function getStudentAppExamQuestions(test_id: number) {
  return http({
    url: '/getStudentAppExamQuestions.do',
    method: 'post',
    data: {
      key: test_id,
    },
  });
}

export function studentAppSubmitExam(
  student_id: number,
  test_id: number,
  consume_time: number,
  cheating: 0 | 1,
  singles: any[],
  selections: any[],
  judges: any[]
) {
  return http({
    url: '/studentAppSubmitExam.do',
    method: 'post',
    data: {
      student_id,
      test_id,
      consume_time,
      cheating,
      singles,
      selections,
      judges,
    },
  });
}
